package vip.web3.admin.sys.controller.sys;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.web3.api.entity.base.PlatformConfig;
import vip.web3.api.service.base.PlatformConfigService;
import vip.web3.common.utils.PageUtils;
import vip.web3.common.utils.R;

import javax.annotation.Resource;
import java.util.Map;

/**
 * PlatformConfigController
 *
 * @date 2024/10/16
 */
@RestController
@RequestMapping("/sys/plat")
public class PlatformConfigController {

    @Resource
    private PlatformConfigService platformConfigService;

    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = platformConfigService.queryPage(params);
        return R.ok().put("page", page);
    }

    @PostMapping("/add/config")
    public R addConfig(@RequestBody @Validated PlatformConfig platformConfig) {
        return R.ok().put("data", platformConfigService.add(platformConfig));
    }

}
